<?php
namespace	Wap\Service;


class UUIDService
{
	public static function generate( $prefix = "" )
	{
		$result	=	"";

		$chars = md5(uniqid(mt_rand(), true));
		$uuid  = substr($chars,0,8) . '-';
		$uuid .= substr($chars,8,4) . '-';
		$uuid .= substr($chars,12,4) . '-';
		$uuid .= substr($chars,16,4) . '-';
		$uuid .= substr($chars,20,12);

		return $prefix . $uuid;
	}

	public static function generate_num( $length = 1 )
	{
		return rand(pow(10,($length-1)), pow(10,$length)-1);
	}
}
?>
